package cn.pattern.demo6;

import net.sf.cglib.proxy.Enhancer;

/**
 * @auth wzy
 * @date 2023/10/10 17:27
 */
public class IntermedirayFactory {

    // 业务
    private static IntermediaryMethodInterceptor callback = new IntermediaryMethodInterceptor();

    public static <T> T create(Class<T> target){
        Enhancer enhancer = new Enhancer();
        enhancer.setCallback(callback);
        enhancer.setSuperclass(target);
        return (T)enhancer.create();
    }
}
